package ift585.tp3;

import java.io.IOException;
import java.net.HttpURLConnection;

public class DisplayUtility {
	public static void showStatus(HttpURLConnection conn) throws IOException {
		System.out.println("Status :");		
		System.out.println(conn.getHeaderFields().get(null).get(0) + "\n");
	}

	public static void showHeader(HttpURLConnection conn) {
		System.out.println("Header :");
		for(String oneHeaderKey : conn.getHeaderFields().keySet()){
			if(oneHeaderKey != null){
				System.out.println(oneHeaderKey + " -> ");
				
				String data = "";
				for(String oneField : conn.getHeaderFields().get(oneHeaderKey)){
					data += oneField + ", ";
				}
				
				System.out.println(data.substring(0, data.length()-2) + "\n");
			}
		}
	}
}
